{% extends 'inquire/base.html' %}

{% block title %}
    以人员资产查询区
{% endblock %}

{% block startbody %}
    {#查询后的显示部分#}
    <div class="container">
        <div class="page-header">
            <h1>{{ title }}</h1>
        </div>
        <p class="lead">Pin a fixed-height footer to the bottom of the viewport in desktop browsers with this custom
            HTML and CSS. A fixed navbar has been added with <code>padding-top: 60px;</code> on the <code>body &gt;
                .container</code>.</p>
        <p>Back to <a href="#">the default sticky footer</a> minus the navbar.</p>
    </div>

    {#查询一#}
    <div class="container">
        <div class="row">
            <form action="{% url 'asset_search:search' %}" method="post">
                {% csrf_token %}
                <div class="form-group col-sm-6 col-xs-6">
                    <label for="exampleInputEmail">根据保管人查询：</label>
                    <select class="form-control" id="exampleInputEmail" name="asset">
                        {% for user in user_name_list %}
                            {% if asset == user.id %}
                                {#selected 默认选择#}
                                <option value="{{ user.id }}" selected>{{ user.name }}</option>
                            {% else %}
                                <option value="{{ user.id }}">{{ user.name }}</option>
                            {% endif %}
                        {% endfor %}
                    </select>
                </div>
                <div class="form-group col-md-2">
                    <label for="exampleInputEmail">&emsp;</label><br>
                    <button type="submit" class="btn btn-default" data-dismiss="modal">查询</button>
                </div>
            </form>
        </div>
    </div>
    <hr>
    {#查询结果#}
    <div style="margin: 10px auto;width: 85%;">
        <h3>查询结果：</h3>
        <table class="table table-striped table-bordered table-hover">
            <tr>
                <th>物资&emsp;&emsp;</th>
                <th>地址&emsp;</th>
                <th>保管人&emsp;</th>
                <th>数量&emsp;</th>
                <th>单位&emsp;</th>
                <th>查询及转移</th>
            </tr>
            {% for a in list_data %}
                <tr>
                    <td>{{ a.0 }}&emsp;</td>
                    <td>{{ a.1 }}楼{{ a.2 }}层{{ a.3 }}室&emsp;</td>
                    <td>{{ a.4 }}&emsp;</td>
                    <td>{{ a.5 }}&emsp;</td>
                    <td>{{ a.6 }}&emsp;</td>
                    <td width="150px;">
                        <a href="{% url 'asset_search:amend' uid=a.7 %}" class="btn btn-primary">修改</a>
                        <a href="{% url 'asset_turn:asset_turn' %}?stockcontrol_id={{ a.7 }}"
                           class="btn btn-primary">转移</a>
                    </td>
                </tr>
            {% empty %}
                <tr>
                    <td colspan="7">此人没有保管任何东西</td>
                </tr>
            {% endfor %}
        </table>
    </div>
{% endblock %}

